﻿@{
    ViewBag.Title = "页面按钮列表";
}
<div class="breadcrumbs" id="breadcrumbs">
    <ul class="nav nav-tabs">
        <li class="active"><a href="/System/PageAction">页面按钮列表</a></li>
    </ul>
</div>
<form id="searchForm" class="breadcrumb form-search">
    <a id="AddNewRole" class="btn btn-xs btn-primary Add-R" data-toggle="modal" href="" onclick="showLayerOpen('添加新按钮', '/System/PageAction/Edit/0', '500px', '400px')" title="添加新按钮">
        <i class="icon-plus-sign bigger-130"></i>
        添加新按钮
    </a>
</form>
<table id="dataTable" class="table table-striped table-bordered table-hover">
    <thead>
        <tr>
            <th width="30">序号</th>
            <th>按钮名称</th>
            <th>按钮代码</th>
            <th>是否显示</th>
            <th>排序</th>
            <th style="width: 120px;">
                操作
            </th>
        </tr>
    </thead>
</table>
@section scripts{
    @Scripts.Render("~/bundles/datatable")
    @Styles.Render("~/Content/datatable")
    <script type="text/javascript">
        var isSearch = false;
        $(function () {
            var objTable = $("#dataTable").dataTable({
                fnDrawCallback: function () {
                    ControlPermissionOperate();
                },
                "sAjaxSource": "/System/PageAction",
                "aaSorting": [[6, "asc"]],
                aoColumns: [
                    {
                        "mData": null,
                        "bSortable": false,
                        "fnRender": function (nRow) {
                            return nRow.iDataRow + 1;
                        }
                    },
                    { "mData": "ActionName" },
                    { "mData": "ActionCode" },
                    {
                        "mData": null, fnRender: function (nRow) {
                            return nRow.aData.IsAvailable ? bootStrapOkIncon : bootStrapRemoveIncon;
                        }
                    },
                    { "mData": "OrderIndex" },
                    {
                        "mData": null,
                        "bSortable": false, fnRender: function (nRow) {
                            var html = "<a class=\"green Edit-R\" href=\"javascript:showLayerOpen('编辑按钮','/System/PageAction/Edit/" + nRow.aData.ID + "','500px','400px')\" title=\"编辑\"><i class=\"icon-pencil bigger-130\"></i></a>"; //编辑
                            html += "<a class=\"red Disabled-R\" href=\"javascript:UpdateStatus('" + nRow.aData.ID + "'," + !nRow.aData.IsAvailable + ",'/System/PageAction/UpdateStatus','dataTable')\" title=\"" + (!nRow.aData.IsAvailable ? "启用" : "禁用") + "\">" + (!nRow.aData.IsAvailable ? bootStrapOkIncon : bootStrapRemoveIncon) + "</a>";

                            html += "<a  href=\"javascript:DeleteObj('" + nRow.aData.ID + "','/System/PageAction/DeletePageAction','dataTable')\" class=\"Delete-R DeleteRole\" title=\"删除\"><i class=\"icon-trash red bigger-120\"></i></a>";
                            return html;
                        }
                    }
                ]
            });

        });
    </script>
}

